package com.wuli.auth.controller;

import com.wuli.auth.common.model.R;
import com.wuli.auth.entity.Role;
import com.wuli.auth.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "角色管理")
@RestController
@RequestMapping("/auth/Role")
public class RoleController {

    @Autowired
    RoleService roleService;

    @ApiOperation("新增角色")
    @GetMapping("/Add/{role}")
    public R Add(@PathVariable String role) {
        roleService.Add(role);
        return new R().Success("新增角色成功");
    }

    @ApiOperation("获取所有角色")
    @GetMapping("/GetAllRole")
    public R<List<Role>> GetAllRole() {
        List<Role> roleEntities=roleService.GetAllRole();
        return new R().Success(roleEntities);
    }
}
